package com.cisetech.util.html;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.cisetech.vo.bobocai.LResources;

//按钮需要拼装的html
public class ResourcesHtmlUtil {
	public static StringBuffer getResourcesHtml(HttpServletRequest request,List<LResources> list){
		/**
		 * <div class="leftnav-title">
    <strong><span class="icon-list"></span>菜单列表</strong>
   </div>
		  <h2><span class="icon-user"></span>基本设置</h2> 
   <ul style="display:block"> 
    <%-- <li><a href="${ctx}/index"><span class="icon-caret-right"></span>网站设置</a></li> 
    <li><a href="${ctx}/password"><span class="icon-caret-right"></span>修改密码</a></li> 
    <li><a href="${ctx}/activity"><span class="icon-caret-right"></span>活动管理</a></li> 
    <li><a href="${ctx}/adv"><span class="icon-caret-right"></span>首页轮播</a></li> 
    <li><a href="${ctx}/book"><span class="icon-caret-right"></span>留言管理</a></li> 
    <li><a href="${ctx}/column"><span class="icon-caret-right"></span>栏目管理</a></li>  --%>
    <%=s.getAttribute("resourceshtml") %>
   </ul> 
   <!-- <h2><span class="icon-pencil-square-o"></span>栏目管理</h2> 
   <ul> 
    <li><a href="list.html" target="right"><span class="icon-caret-right"></span>内容管理</a></li> 
    <li><a href="add.html" target="right"><span class="icon-caret-right"></span>添加内容</a></li> 
    <li><a href="cate.html" target="right"><span class="icon-caret-right"></span>分类管理</a></li> 
   </ul>  -->
		 * 
		 * 
		 * 
		 * 
		 * 
		 */
		StringBuffer str = new StringBuffer();
		str.append("<div class='leftnav-title'>");
		str.append("<strong><span class='icon-list'></span>菜单列表</strong>");
		str.append("</div>");
		for (int i = 0; i < list.size(); i++) {
			if("0".equals(list.get(i).getGrade())){
				str.append("<h2><span class='icon-user'></span>"+list.get(i).getName()+"</h2>");
				str.append("<ul style='display: none;'>");
				for (int j = 0; j < list.size(); j++) {
					if(list.get(i).getId().toString().equals(list.get(j).getSupergrade())){
						str.append("<li><a href='"+request.getContextPath()+list.get(j).getSite()+"'><span class='icon-caret-right'></span>"+list.get(j).getName()+"</a></li>");
					}
				}
				str.append("</ul>");
			}
		}
		
		return str;
	}
}
